package com.xiaoxi.exam.config;

import com.github.wxpay.sdk.WXPayConfig;
import com.xiaoxi.exam.consts.Const;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;

import javax.annotation.PostConstruct;
import java.io.InputStream;

@ConfigurationProperties(prefix = "wechat")
@Configuration
public class XiaoxiWXAccountConfig implements WXPayConfig {

    private InputStream certBis;

    @PostConstruct
    public void init() throws Exception {
        Const.FEE_MAP.put("TOEFL_FEE", "198");
        Const.FEE_MAP.put("IELTS_FEE", "100");
        Const.FEE_MAP.put("cost", "1985");
        Const.FEE_MAP.put("urgent", "2295");
        Const.FEE_MAP.put("extra", "310");

    }

    @Override
    public String getAppID() {
        return "wxb4c8094a86b69567";
    }

    @Override
    public String getMchID() {
        return "1507282031";
    }

    @Override
    public String getKey() {
        return "TabhQ57wYShhM1WXflpFUqbPihLk8d3r";
    }

    @Override
    public InputStream getCertStream() {
        return certBis;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }

    public void setCertBis(InputStream certBis) {
        this.certBis = certBis;
    }
}
